package com.ruoyi.system.chat.chatqwen.entity;


import com.fasterxml.jackson.annotation.JsonProperty;
import com.ruoyi.common.entity.AiModelEntity;
import com.ruoyi.common.entity.ApiKeyEntity;
import com.ruoyi.system.chat.entity.AiRequestEntity;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Data
public class ChatRequestEntity extends AiRequestEntity {

    private Long modelId;

    private String model;

    private String key;

    private String stream;

    private Double temperature;

    @JsonProperty("presence_penalty")
    private Double presencePenalty;

    @JsonProperty("frequency_penalty")
    private Double frequencyPenalty;

    private List<Message> messages;

    private Map<String,List<String>> variables;

    private AiModelEntity modelEntity;

    private ApiKeyEntity apiKeyEntity;

    private String fileName;

    private String text;

    private String imgUrl;

    @Data
    public static class Message {
        private String name;
        private String role;
        private Object content;
        public boolean hasName = false;
    }

    public ChatRequestEntity pureClone() {
        ChatRequestEntity instance = new ChatRequestEntity();
        instance.setModel(model);
        instance.setStream(stream);
        instance.setPresencePenalty(presencePenalty);
        instance.setFrequencyPenalty(frequencyPenalty);
        instance.setMessages(messages == null ? null : new ArrayList<>(messages));
        //instance.setModelEntity(modelEntity);
        //instance.setApiKeyEntity(apiKeyEntity);
        return instance;
    }
}
